package cn.fivestars.springcloud.payment.serivce;

import cn.fivestars.springcloud.commons.entities.Payment;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;

/**
 * PaymentService
 *
 * @author liangchenzhou1024 @163.com
 * @date 2021 /2/1
 */
public interface PaymentService {
    /**
     * Insert Payment
     *
     * @param payment payment
     * @return the int
     */
    int insert(Payment payment);

    /**
     * insert const time
     *
     * @param payment payment
     * @return count int
     */
    int insertTimeOut(Payment payment);

    /**
     * Fallback
     *
     * @param payment payment
     * @return error code
     */
    int error(Payment payment);


    /**
     * Select by id payment
     *
     * @param id id
     * @return the payment
     */
    Payment selectById(Long id);


    /**
     * Select by id timeout payment
     *
     * @param id id
     * @return the payment
     */
    Payment selectByIdTimeout(Long id);

    /**
     * Handle time out of select by id timeout payment
     *
     * @param id id
     * @return the payment
     */
    Payment handleTimeOutOfSelectByIdTimeout(Long id);

    // ================= 服务熔点 =====================
    Payment paymentCircuitBreaker(Long id);

    Payment paymentCircuitBreakerFallback(Long id);
}
